<?php
include 'common.php';

switch (CommonUtils::input('action')) {
    case 'install':
        $msgInfo = CommonUtils::stdmessage(1, '');
        CommonUtils::outputJson($msgInfo);
        break;
    case 'serverinfo':
        $serverInfo = [
            ['text' => '操作系统', 'minValue' => '不限制', 'recommendValue' => 'Linux', 'value' => PHP_OS, 'comment' => ''],
            ['text' => 'PHP版本', 'minValue' => '8.0', 'recommendValue' => '8.1', 'value' => PHP_VERSION, 'comment' => '使用路由注解需要最低PHP8.0'],
            ['text' => 'MySQL版本', 'minValue' => '8.0', 'recommendValue' => '8.0', 'value' => '-', 'comment' => '无法获取：未配置数据库连接信息'],
            ['text' => '附件上传', 'minValue' => '2M', 'recommendValue' => '2M', 'value' => checkCfgVar('upload_max_filesize'), 'comment' => ''],
            ['text' => 'GD库版本', 'minValue' => '2.0', 'recommendValue' => '2.1', 'value' => GD_VERSION, 'comment' => ''],
            ['text' => '磁盘空间', 'minValue' => '100MB', 'recommendValue' => '不限制', 'value' =>CommonUtils::formatBytes(@disk_free_space(".")), 'comment' => ''],
        ];
        $data = [
            'serverInfo' => $serverInfo,
        ];
        $msgInfo = CommonUtils::stdmessage(1, '', $data);
        CommonUtils::outputJson($msgInfo);
        break;
    default:
        break;
}
